<template>
  <div>
    <!-- :style="{paddingLeft:padd==0?'0':'102px'}" -->
    <div v-loading="$store.state.loading">
      <div
        class="brief_nav_box"
        v-if="navHid"
      >
        <div
          :class="contmar"
          v-if="navList!=undefined"
        >
          <a
            :style="{color:item[0].sortId==activeId?'#E6142F':'#000000'}"
            @click="handNav(item)"
            href="javascript:;"
            class="nav_title nowrap"
            v-for="item in navList"
            :key="item[0].sortId"
          >{{item[0].aName}}</a>
        </div>
      </div>
      <div class="cut_off">

      </div>
      <div class="crumbs_x">

        <div class="brief_content_left">
          <div>
            <div class="brief_left_btn">
              <zdyBtn
                :title="navName"
                :width="'261px'"
                :height="'49px'"
              ></zdyBtn>
            </div>
            <div class="brief_left_content">
              <ul
                class="content_list"
                v-if="navList!=undefined"
              >
                <li
                  v-for="item in navList"
                  :key="item[0].sortId"
                  @click="handNav(item)"
                  :style="{color:item[0].sortId==activeId?'#E6142F':'#000000'}"
                  class="content_item pointer"
                >{{item[0].aName}}</li>
              </ul>
            </div>
          </div>
          <div class="brief_left_serve">
            <zdyBtn
              :title="'服务热线'"
              :width="'261px'"
              :height="'49px'"
            ></zdyBtn>
            <div class="serve_box">
              <div class="serve_phone_box">
                <div class="serve_phone">
                  <img
                    class="phone_img"
                    src="../assets/imges/phone.png"
                    alt=""
                  >
                </div>
                <div class="phone_num_box">
                  <p
                    class="phone_num"
                    style="margin-bottom: 15px"
                  >电话:</p>
                  <p class="phone_num">0376-6226789 </p>
                </div>
              </div>
              <div class="the_phone">
                <div class="the_phone_off">

                </div>
                <div class="the_phone_title">
                  The&nbsp; &nbsp;phone
                </div>
                <div class="the_phone_off">

                </div>
              </div>

            </div>

          </div>
        </div>
        <div class="crumbs_box_pos">
          <div class="crumbs_box">
            <zdyBtn
              :title="navName"
              :width="'140px'"
              :height="'49px'"
            ></zdyBtn>
            <div>
              <div class="crumbs_title">
                当前位置: <span>首页</span><span> > </span><span>{{$route.meta.title}}</span><span> > </span><span class="nav_name">{{navName}}</span>
              </div>
            </div>
          </div>
          <div class="crumbs_content">
            <slot></slot>
          </div>
        </div>

      </div>
    </div>
  </div>

</template>

<script>
import zdyBtn from "@/components/zdyBtn.vue";
export default {
  name: "crumbs.vue",
  props: {
    navList: {
      type: Array
    },
    padd: {
      type: String
    },
    contmar: {
      type: String
    },
    navHid: {
      type: Boolean,
      default: true
    },
    oneActive: {
      type: Boolean,
      default: false
    }
  },

  components: {
    zdyBtn
  },
  data() {
    return {
      activeId: "",
      navName: ""
    };
  },
  created() {},
  watch: {
    navList: function() {
      // this.navList = this.navList.filter(item => {
      //   return item.length != 0;
      // });
      if (this.$route.query.sortId || this.$route.query.title) {
        var item = [
          {
            sortId: this.$route.query.sortId,
            aName: this.$route.query.title
          }
        ];
        this.handNav(item, 1);
      } else {
        this.navName = this.navList[0][0].aName;
        this.activeId = this.navList[0][0].sortId;
      }
    }
  },
  mounted() {
    if (this.oneActive) {
      // if (this.$route.query.itemId) {
      //   this.activeId = this.$route.query.itemId;
      // } else {
      // }
      // this.$store.commit("handBus", false);

      this.activeId = this.navList[0][0].sortId;
      this.navName = this.navList[0][0].aName;
    }
  },
  methods: {
    handNav(item, type) {
      if (type != 1) {
        this.$store.commit("handBus", false);
      }
      this.activeId = item[0].sortId;
      this.navName = item[0].aName;
      this.$emit("handSonNav", item[0].sortId);
    }
  }
};
</script>

<style lang='scss' scoped>
.crumbs_box_pos {
  position: relative;
}
.contmar {
  margin: 0 auto;
}
.cut_off {
  width: 100%;
  height: 10px;
  background: rgba(157, 200, 231, 1);
  margin-bottom: 10px;
}
.brief_nav_box {
  width: 100%;
  height: 62px;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  // padding-left: 102px;
  .nav_title::after {
    content: "|";
    margin-right: 30px;
    margin-left: 30px;
  }
  .nav_title:last-child::after {
    content: "";
  }
  .nav_title {
    font-size: 18px;
    color: #333333;
  }
  .nav_x {
    margin-right: 30px;
    margin-left: 30px;
  }
}
.crumbs_x {
  display: flex;
}
.brief_content_left {
  margin-right: 20px;
  width: 261px;
  background: rgba(255, 255, 255, 1);
  .brief_left_serve {
    margin-top: 20px;
    .serve_box {
      border: 1px solid rgba(204, 204, 204, 1);
      border-top: 0;
      padding: 40px 29px 0 29px;
      .the_phone {
        display: flex;
        align-items: center;
        margin-top: 38px;
        margin-bottom: 40px;
        .the_phone_off {
          width: 53px;
          height: 1px;
          // border: 1px solid rgba(204, 204, 204, 1);
          background-color: rgba(204, 204, 204, 1);
        }
        .the_phone_title {
          font-size: 14px;
          font-weight: 400;
          margin-right: 10px;
          margin-left: 10px;
          color: rgba(128, 128, 128, 1);
        }
      }
      .serve_phone_box {
        display: flex;
        align-items: center;
        .phone_num_box {
          margin-left: 21px;
          .phone_num {
            color: #808080;
            font-size: 18px;
          }
        }

        .serve_phone {
          width: 51px;
          height: 51px;
          background: rgba(255, 255, 255, 1);
          border: 2px solid rgba(18, 150, 219, 1);
          border-radius: 50%;
          position: relative;
          .phone_img {
            width: 25px;
            height: 25px;
            position: absolute;
            top: 50%;
            left: 50%;
            margin-top: -12.5px;
            margin-left: -12.5px;
          }
        }
      }
    }
  }
  .brief_left_content {
    // height: 162px;
    border: 1px solid rgba(204, 204, 204, 1);
    border-top: 0;
    width: 100%;
    padding-right: 13px;
    padding-left: 13px;
    .content_list {
      margin-bottom: 20px;
      .content_item {
        width: 100%;
        padding-top: 15px;
        padding-bottom: 15px;
        border-bottom: 1px solid #eeeeee;
        text-align: center;
        color: #333333;
        font-size: 16px;
      }
    }
  }
}
.crumbs_content {
  width: 919px;
  border: 1px solid rgba(204, 204, 204, 1);
  padding: 30px;
  .crumbs_cont_txt {
    margin-top: 40px;
    font-size: 16px;
    font-weight: 400;
    line-height: 35px;
    color: rgba(51, 51, 51, 1);
  }
}
.crumbs_box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 919px;
  .crumbs_title {
    margin-right: 20px;
    color: #333333;
    font-size: 16px;
    .nav_name {
      color: #e6142f;
    }
  }
}
</style>
